<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Login extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index()
	{
		$this->load->helper('form');
	    $this->load->view('login');
	    $user = array(
	    	'class' => 'form', 
	    	'id' 	=> 'login');
	    echo form_open('login/dologin',$user);
	    echo form_input('user','username');
	    echo form_password('password','pwd');
	    echo form_submit('mysubmit', 'Submit Post!');
	}
	public function dologin()
	{
		$this->load->model('admin_model');
		$user = array(
				'name' => $this->input->post('user'),
				'pwd'  => $this->input->post('password')
			);
		if($this->admin_model->admin_login_validation($user) === true)
		$this->load->view('frame',$user);
		else 	{$msg['text'] =  "fail";	
		$this->load->view('unittest',$msg);}
		return;


	}
	public function show_menu()
	{
		$this->load->view('menu');
	}
		public function show_logo()
	{
		$this->load->view('show_logo');
	}

}
